package fox.framework.rpc.server.dispatcher;


import fox.framework.rpc.converter.RpcMessageConverters;
import fox.framework.rpc.exception.RpcRuntimeException;
import fox.framework.rpc.server.dispatcher.invoke.ProvideInvoker;
import fox.framework.rpc.server.dispatcher.router.RouteMapping;
import fox.framework.rpc.server.dispatcher.router.RpcRouter;
import fox.framework.rpc.server.message.request.RpcServerRequest;

import java.util.List;

/**
 * @author cuichao
 * @Description: DefaultRequestDispatcher
 * @Date: create in 2021/1/21 15:17
 */
public class DefaultRequestDispatcher extends AbstractRpcRequestDispatcher {


    public DefaultRequestDispatcher(RpcMessageConverters converters, RpcRouter router, List<ProvideInvoker> chains) {
        super(converters, router, chains);
    }


    @Override
    protected RouteMapping processNoRouteMappingHandler(RpcRouter router, RpcServerRequest request) throws RpcRuntimeException {
        String path = request.getPath();
        String msg = String.format("this request url : %s is not mapping at provider server",path);
        throw new RpcRuntimeException(msg);
    }
}
